package com.jr.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;

@WebServlet("/login")
public class LoginController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String uname = req.getParameter("uname");
        String upwd = req.getParameter("upwd");
        if("admin".equals(uname)&&"1234".equals(upwd)){
         /*   Cookie cookie=new Cookie("user",uname+":"+upwd);
            resp.addCookie(cookie);*/
            HttpSession session = req.getSession();
            session.setAttribute("EmpUser","user");
            resp.sendRedirect("projectInfo/showdt");
        }else{
            resp.sendRedirect("login.jsp");
        }
    }
}
